UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'VKqJpljfR8/glme3LdZxv9jAo7sMHk4KMPnx03lAbQc='
WHERE
key_id = 'e51585abda232308a53fda29f0078b05cd44e957674574d0249c10737f4a1eb0'
AND (
token = 'VKqJpljfR8/glme3LdZxv9jAo7sMHk4KMPnx03lAbQc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)