UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'H40S4PksyVRtQnPeqCeuTr+yX92C9geGaObAn9kh4l8='
WHERE
key_id = 'dc87c9280ac839b112ac96f93417243c4fe2d5da2a70365a7577e10f13f9556b'
AND (
token = 'H40S4PksyVRtQnPeqCeuTr+yX92C9geGaObAn9kh4l8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)