UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'U2GRPoFUreEPfz00yfRkBSUjweL8CrS+sfse5zqzbk8=' 
WHERE 
  key_id = 'e31eb0dd066eec4221188d9d28c197a21e5bfd8d73018f3fc2847bdd36a36539' 
  AND (
    token = 'U2GRPoFUreEPfz00yfRkBSUjweL8CrS+sfse5zqzbk8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016