UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CU/XeLPDKGfURIVU7kCBoiZQEo1JgFHtyYcrdH3lUA8='
WHERE
key_id = 'a50705a5ea101a39eb7870f51206fd0a529f091cb67dbb5943c9cb78edef56d7'
AND (
token = 'CU/XeLPDKGfURIVU7kCBoiZQEo1JgFHtyYcrdH3lUA8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)