UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jWwrk4oYqMi76PD9b8mKowTpGZgHOc2xW4ZAt03PSM0='
WHERE
key_id = '3e81c6abd23e54b96bc4e469983fbc115a2a2cc55f4da1502f0a9f0bfc90816d'
AND (
token = 'jWwrk4oYqMi76PD9b8mKowTpGZgHOc2xW4ZAt03PSM0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)