UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JD8j8BVIDuE1oNgYZgbo3Bo3ey2FivY57xoHvngzq18=' 
WHERE 
  key_id = '0f54457164dd934ec42bc3a7d4570acb52dc42a704330415cbee4f96af74dc06' 
  AND (
    token = 'JD8j8BVIDuE1oNgYZgbo3Bo3ey2FivY57xoHvngzq18=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023