UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Bo7A+rz7VEgVHU45NAoDHpuIXs7KlEHDH6PYb+Wex7Q='
WHERE
key_id = '9477ea4b689e656f2b4936dcf452bc62b1efeea546e23049b3daad677f3644fe'
AND (
token = 'Bo7A+rz7VEgVHU45NAoDHpuIXs7KlEHDH6PYb+Wex7Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)