UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'X5VIjTCKRFSeuddN5QL82L6YLT3RxfSXDBTJffMBFkw='
WHERE
key_id = '075f87ade4a96446587fedb570ae44bfae162a79c690633828fb4459e2454acd'
AND (
token = 'X5VIjTCKRFSeuddN5QL82L6YLT3RxfSXDBTJffMBFkw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)