UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SrEFS7Pfh6utd4VaFAhTgKIUfn8q52WSd/WLa99IS4c='
WHERE
key_id = '5037ad4635ff7d89071244897c400f8c7a90f0bb43d44a1593568a41f7207429'
AND (
token = 'SrEFS7Pfh6utd4VaFAhTgKIUfn8q52WSd/WLa99IS4c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)