UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MiRPdhGZDzaheYmX5ZhsmEdTbJP4qtbCxdS2t2b3V5o='
WHERE
key_id = '65260a4897a780d0865dcbcf8f0a85bcc90669cd771fea3e668141dff0da768a'
AND (
token = 'MiRPdhGZDzaheYmX5ZhsmEdTbJP4qtbCxdS2t2b3V5o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)