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