UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3jHrE3pFztimnX+myEWdFx0eDH0m0iT8R4emHGug71I=' 
WHERE 
  key_id = 'd827fd95e716dc9fe2804b59062f79615743fdb3f95a72776ac7544473494401' 
  AND (
    token = '3jHrE3pFztimnX+myEWdFx0eDH0m0iT8R4emHGug71I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041