UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'edQfMORTDfCLv9k6n9JRoMYqiQulNNeDEN885y7o6og=' 
WHERE 
  key_id = 'c196bbdf8aad34528c2f13f34ed08b9603f23719075a840f70b980fd3c3ca710' 
  AND (
    token = 'edQfMORTDfCLv9k6n9JRoMYqiQulNNeDEN885y7o6og=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030