UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'R9OPzJPoTDDbdHh/yEq0dwSCA2SjUYIyi7zSqInzqoM='
WHERE
key_id = '3e2ea0128fcd6d60d6e1edfd73272e85a12e7eed94af52927dcd668744bad3ad'
AND (
token = 'R9OPzJPoTDDbdHh/yEq0dwSCA2SjUYIyi7zSqInzqoM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)