UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dDowQ9ad6UFnN/voqrsldq6vIDsE3cXgUOFNcmh56Dk='
WHERE
key_id = '0ac2bfd975c9a57f78c5f27c049da1aeca2b92e0f8d18a9ac120d7ac59f520cb'
AND (
token = 'dDowQ9ad6UFnN/voqrsldq6vIDsE3cXgUOFNcmh56Dk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)