UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'H8d7qFVpDx5gx2QpRW5SPD1RbP0NqtHunIzF52SsFv8='
WHERE
key_id = '29e83f07759c92a05b821c1c1f59d684b1ace9c9df2da0b979e6f00633b37e87'
AND (
token = 'H8d7qFVpDx5gx2QpRW5SPD1RbP0NqtHunIzF52SsFv8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)