UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RDWBIH0vobUcsPZ4tnfixk6HQpfSr58KyGXbxrXRItU='
WHERE
key_id = '7bea9a99b64ec293b0fe63d8dc6e3d51e6fceb722f3ce228607b1ff40347bb2e'
AND (
token = 'RDWBIH0vobUcsPZ4tnfixk6HQpfSr58KyGXbxrXRItU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)