UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'as3TYL+0koiZ5DZySCWpwjabeZX3aIY7XzUKjwNJLNg='
WHERE
key_id = 'ad5ef0d94c9e9e22393668ce244b2c341616e571418ca131452ca73d84df9cc3'
AND (
token = 'as3TYL+0koiZ5DZySCWpwjabeZX3aIY7XzUKjwNJLNg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)