UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rQdT0bhuvBYG8P1Cy0PIzmbpp4T0nwWofGGsN+hdVR0='
WHERE
key_id = '671ef9e68f0f2c72f3e14060984ce21c2318e183dfa52b74cc2b5f4514188389'
AND (
token = 'rQdT0bhuvBYG8P1Cy0PIzmbpp4T0nwWofGGsN+hdVR0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)