UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AOREDgYgvBQKMo06EhqruDltw9J4Y47uX3iK1KUswxU='
WHERE
key_id = '6d2d2a47c98894b89f77fa868df3eddb57d87f21fe77462594c53ca739edae15'
AND (
token = 'AOREDgYgvBQKMo06EhqruDltw9J4Y47uX3iK1KUswxU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)