UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cxaxEWE/i+s3HUnTdBWQaeEfeKwsY5p6VYTjBW256N0='
WHERE
key_id = 'e1dd75bd7243d7d4c4fdf5c25d1b6ebf66127c6433e394fa06f5bc3ecc494564'
AND (
token = 'cxaxEWE/i+s3HUnTdBWQaeEfeKwsY5p6VYTjBW256N0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)