UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'E45LqMHRm72k6NJgB47VNh0KlfLKgqy3Jzr+ifjwtvg=' 
WHERE 
  key_id = 'acabf83b393bfc41c4c45edf59229f5224219660bac6b690d2c5e7e9483d928f' 
  AND (
    token = 'E45LqMHRm72k6NJgB47VNh0KlfLKgqy3Jzr+ifjwtvg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042