UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'F9R58OuLB7f2P9+rf883KowFz3y+u9zYqTm7LxShBFI=' 
WHERE 
  key_id = 'caf4747e52d8acff98bb0e555be86fa5d372a55b01c93768612d3674cfd33cd1' 
  AND (
    token = 'F9R58OuLB7f2P9+rf883KowFz3y+u9zYqTm7LxShBFI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038