UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gp0FOe0YdMqVt+cRfr4H0v/wFygWgYiiJwzADW/heyk='
WHERE
key_id = '1d67ddbdee811a26231d525293dc9cbad397f695ab4fda44958a64f172e2000f'
AND (
token = 'gp0FOe0YdMqVt+cRfr4H0v/wFygWgYiiJwzADW/heyk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)