UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ed3MoRpccgkijv+A3wgbWWvHGBTigtj+Cm/JMcLs3Io='
WHERE
key_id = 'ea70022fb51273a7b049e12a94615664bd80ba1cfa699d769509ed31430b8b0a'
AND (
token = 'ed3MoRpccgkijv+A3wgbWWvHGBTigtj+Cm/JMcLs3Io='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)