UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kHcvrBrForxjuHRo7l5Rf6YcKFumAsPXz8e8xbmkH7g='
WHERE
key_id = 'f2c2943eaedf007221a1ccce4e30f579d5bed651b2881d937469d43f671fbb82'
AND (
token = 'kHcvrBrForxjuHRo7l5Rf6YcKFumAsPXz8e8xbmkH7g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)