UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '21qF9vi1ixj6Dx+gfTHUv9ymMFPNEXZd/Z2UUx5CVlI=' 
WHERE 
  key_id = '87daac07217ba5533ca4c5f6f9c65b66c957eabb9a23648cd816d6dd6817c84b' 
  AND (
    token = '21qF9vi1ixj6Dx+gfTHUv9ymMFPNEXZd/Z2UUx5CVlI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037