UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iw4DNLxoAU0NIf51HkARAtWPN3cEo2ikbekbXg7dx54='
WHERE
key_id = 'b37f9d4b3cd515076d70273cfc4c4c189af233975dabc3f24bd242bbef917b8e'
AND (
token = 'iw4DNLxoAU0NIf51HkARAtWPN3cEo2ikbekbXg7dx54='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)