UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BoK3m5iPZo85QmJwkVHtatEVi/aGYhfeEmhIZncSolw=' 
WHERE 
  key_id = '50ff28f687156c2c028e885e3d8e398511ff519f337bf0f8d5ac4c43d54ba5ed' 
  AND (
    token = 'BoK3m5iPZo85QmJwkVHtatEVi/aGYhfeEmhIZncSolw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050