UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'scN0QQuaYJnO0nTb/gPIaGiqEwOnBoC+sEH+r6K31/I='
WHERE
key_id = '9d5eb0fbd3f9ef319f088ce1e96eeefa2285ef78c6322c023e4ac25ed19fd458'
AND (
token = 'scN0QQuaYJnO0nTb/gPIaGiqEwOnBoC+sEH+r6K31/I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)