UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5fZkU9KsjgChO+1Bqlcd8kp5L7zpFV8+2mu46+3yva4='
WHERE
key_id = 'bc9c122ea8cbe5f1cd44f945805e51689a275d2e740d4123815a02d4793e7b40'
AND (
token = '5fZkU9KsjgChO+1Bqlcd8kp5L7zpFV8+2mu46+3yva4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)