UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'GTSkr4Z4wgMi+5iGtCYo89nQ3BklE8MDXGIq07d6MeM='
WHERE
key_id = 'd87a1e22a05149964a8b4e6865aa13ac26e844c1e61ebdfa5ed72942d264164e'
AND (
token = 'GTSkr4Z4wgMi+5iGtCYo89nQ3BklE8MDXGIq07d6MeM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)